<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:cc="http://java.sun.com/jsf/composite"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.prime.com.tr/ui"
      xmlns:f="http://java.sun.com/jsf/core">

    <!-- INTERFACE -->
    <cc:interface>
    </cc:interface>

    <!-- IMPLEMENTATION -->
    <cc:implementation>
        <p:dataGrid var="gbItem" value="#{groupBuyCustManagedBean.availableItems}" columns="3"  
                    rows="12" paginator="true" effect="true"  
                    paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"  
                    rowsPerPageTemplate="9,12,15">  

            <p:column>  
                <p:panel header="#{gbItem.name}" 
                         footer="Discount: -#{groupBuyCustManagedBean.calculateDiscount(gbItem)}%"
                         style="text-align:center">  
                    <h:panelGrid columns="1" style="width:100%">  

                        <h:outputText value="#{gbItem.description}" />  

                        <p:commandButton value ="discover more about the deal"
                                         action ="GroupBuyingItemPage?faces-redirect=true">  
                            <f:setPropertyActionListener value="#{gbItem}"   
                                                         target="#{groupBuyCustManagedBean.selectedItem}" />
                            <f:setPropertyActionListener target="#{searchManagedBean.tabIdx}"
                                                                 value="2"/>
                        </p:commandButton>
                    </h:panelGrid>  
                </p:panel>  
            </p:column>  
        </p:dataGrid>
    </cc:implementation>
</html>